package org.orz.cloud.common.exception;

/**
 * 业务异常类，业务中需要抛出异常时可以直接抛出此异常，框架中会捕获到并做统一处理
 */
public class BusinessException extends RuntimeException {
    /**
     * 异常码
     */
    private String errorCode;
    /**
     * 异常信息
     */
    private String errorMessage;


    public BusinessException(ErrorCode code){
        super(code.getMessage());
        this.errorCode = code.getCode();
        this.errorMessage = code.getMessage();
    }

    public BusinessException(String errorCode,String errorMessage){
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
}
